package cbp

class ModelPriceController {
  def ebayService
  def index = {
    //ebayService.loadAveragePrice(params.modelId, 2020)
  }
  def boundaries = {
    def price1 = ebayService.loadAveragePrice(params.id, new Integer(params.year1))
    def price2 = ebayService.loadAveragePrice(params.id, new Integer(params.year2))
    render (text: """{"${params.year1}" : ${price1}, "${params.year2}" : ${price2}}""", contentType: "application/json")
  }
  def averagePrice = {
    def price = ebayService.loadAveragePrice(params.id, new Integer(params.year))
    render (text: """{"year" : ${params.year}, "price" : ${price}}""", contentType: "application/json")
  }

}